<%= render "library_sidebar" %>

<% forwarded_params = search_filter_params.merge(
  page: params[:page],
  size: @size.presence
).to_h %>

<%= form_tag delete_multiple_admin_pictures_path(forwarded_params), method: :delete do %>
  <div class="selected_item_tools hidden">
    <h3><%= Alchemy.t(:edit_selected_pictures) %></h3>
    <%= link_to(
      render_icon(:edit, size: '1x') + Alchemy.t("Edit"),
      edit_multiple_admin_pictures_path(forwarded_params),
      class: 'button with_icon',
      title: Alchemy.t('Edit multiple pictures'),
      id: 'edit_multiple_pictures'
    ) %>
    <%= button_tag render_icon("delete-bin-2", size: '1x') + Alchemy.t("Delete"),
      'data-turbo-confirm': Alchemy.t(:confirm_to_delete_images_from_server),
      class: 'button with_icon' %>
    &nbsp;<%= Alchemy.t(:or) %>&nbsp;
    <%= link_to(
      render_icon(:close) + Alchemy.t("Clear selection"),
      admin_pictures_path(forwarded_params),
      class: 'secondary button with_icon'
    ) %>
  </div>
  <% if @pictures.blank? && @recent_pictures.blank? && search_filter_params[:q].blank? %>
    <%= render_message do %>
      <%= Alchemy.t(:no_images_in_archive) %>
    <% end %>
  <% elsif @pictures.blank? && @recent_pictures.blank? %>
    <%= render_message do %>
      <%= Alchemy.t(:no_search_results) %>
    <% end %>
  <% else %>
    <div id="pictures" class="picture-size--<%= @size %>">
      <%= render partial: "picture", collection: @pictures, locals: {picture_offset: picture_offset} %>
    </div>
  <% end %>
<% end %>

<%= render "alchemy/admin/resources/pagination", resources: @pictures %>
